﻿// JScript 文件

    // 显示对话框(全遮罩)
    function ShowMessageWithCallBack(title, message, type) {
        self.parent.leftFrame.showMask();
        showMassgeBox(title, message, type, 
            function () {
            	self.parent.leftFrame.hideMask();
            });
    }

    //  弹出窗口通用取消按钮的方法
    function ClosePopup(formId)
    {
    	ClosePopForm(formId);
        self.parent.leftFrame.hideMask();
    }
    
    //  初始化样表类别下拉列表
    function InitStcSelect(list, selId) {
        var selectObj = document.getElementById(selId);
        selectObj.innerHTML = "";
        var oOption = document.createElement("OPTION");
        oOption.innerText = "--请选择检查项--";
        oOption.value = -1;
        selectObj.appendChild(oOption);
        if(list != null){
            for(var i = 0; i < list.length; i++) {
                oOption = document.createElement("OPTION");
                oOption.innerText = list[i].name;
                oOption.value = list[i].ID;
                oOption.selected = false;
                selectObj.appendChild(oOption);
            }
        }
    }
    
//-----------------------------------------------------------------------
// 样表类别弹出对话框

    function ShowAddStcFrom() {
        ResetStcPop();
        ShowPopForm("stcPop", "stcPopTitle", "新增检查项");
        self.parent.leftFrame.showMask();
        document.getElementById("hidstcPopType").value = "add";
    }
    
    function ShowModifyStcFrom(obj) {
        ResetStcPop();
        ShowPopForm("stcPop", "stcPopTitle", "修改检查项");
        self.parent.leftFrame.showMask();
        document.getElementById("hidstcPopType").value = "modify";
        document.getElementById("hidStcPopStcId").value = obj.RID;
        document.getElementById("txtStcName").value = obj.ClsName.htmlDecode();
        document.getElementById("hidStcOldName").value = obj.ClsName.htmlDecode();
        
    }
    
    function btnStcPopOK_onclick() {
        if(!VerifyStc())
            return;
            
        if(document.getElementById("hidstcPopType").value == "add")
            AddStyleTableType();
        else if(document.getElementById("hidstcPopType").value == "modify")
            ModifyQuestionnaireType();
    }
    
    // 验证样表类别输入
    function VerifyStc() {
        var stcName = document.getElementById("txtStcName").value;
        if(stcName.replace(/(^\s*)|(\s*$)/g,  "").length < 1) {
            showNoticMsg("txtStcName", QT_MESSAGE_INPUTNAME);
            document.getElementById("txtStcName").focus();
           return false;
        }
        // /<\/?[^>]+>/g
        // /^[^`~!@#$%^&*()+=|\\\][\]\{\}:;'\,.<>/?]{1}[^`~!@$%^&()+=|\\\][\]\{\}:;'\,.<>?]{0,19}$/g;
        if(stcName.search(/[`~!@#$%^&*+=|\\\][\]\{\}:;\"'\,.<>/?]/g) != -1) {
            showNoticMsg("txtStcName", QT_DISABLE_HTML);
            document.getElementById("txtStcName").focus();
           return false;
        }
        var nameList = self.parent.leftFrame.GetAllStcName();
        if(nameList != null && nameList.length > 0) {
            var nameArr = nameList.split(",");
            for(var i = 0; i < nameArr.length; i++) {
                if(stcName.replace(/(^\s*)|(\s*$)/g,  "") == nameArr[i] &&
                document.getElementById("hidStcOldName").value != stcName.replace(/(^\s*)|(\s*$)/g,  "")){
                    showNoticMsg("txtStcName", QT_MESSAGE_BEEN_NAMED_STC);
                    document.getElementById("txtStcName").focus();
                    return false;
                }
            }
        }
        
        return true;
    }
    
    //  重置弹出窗口
    function ResetStcPop(){
        document.getElementById("hidstcPopType").value = "";
        document.getElementById("txtStcName").value = "";
    }
//-----------------------------------------------------------------------

//-----------------------------------------------------------------------
// 样表弹出对话框

    //  显示添加对话框
    function ShowAddFrom(selectedNode, stcId, stcList)
    {
        ResetSTPop();
        ShowPopForm("popup", "formTitle", "新增样表");
        self.parent.leftFrame.showMask();
        InitStcSelect(stcList, "selPopupStc");
        document.getElementById("selPopupStc").disabled = false;
        document.getElementById("hidPopType").value = "add";
        document.getElementById("hidStcId").value = stcId;

        if(stcId == null)
            document.getElementById("selPopupStc").value = "-1";
        else
        {
            var selectObj = document.getElementById("selPopupStc");

            setTimeout(function() { 
                $("#selPopupStc").val(stcId);
            }, 1);
        }
    }
    
    //  显示修改对话框
    function ShowModifyFrom(obj, stcList)
    {
        ResetSTPop();
        ShowPopForm("popup", "formTitle", "修改样表");
        self.parent.leftFrame.showMask();
        InitStcSelect(stcList, "selPopupStc");
       // InitStcSelect(stcList);
        document.getElementById("selPopupStc").disabled = false;
        document.getElementById("selTypeEdit").value = obj.StType;
        document.getElementById("txtName").value = obj.StName.htmlDecode();
        document.getElementById("hidStcId").value = obj.ClsID;
        document.getElementById("hidStId").value = obj.RID;
        document.getElementById("hidPopType").value = "modify";
        document.getElementById("selPopupStc").value = obj.ClsID;
        document.getElementById("hidStOldName").value = obj.StName.htmlDecode();
        

        var selectObj = document.getElementById("selPopupStc");

        setTimeout(function() { 
            $("#selPopupStc").val(obj.ClsID);
        }, 1);
    }
    
    function btnOk_onclick() 
    {
        if(!VerifyStyleTable())
            return;

        if(document.getElementById("hidPopType").value == "add")
            AddStyleTables();
        else if(document.getElementById("hidPopType").value == "modify")
            ModifyQuestionnaire();
    }
    
    // 验证样表输入
    function VerifyStyleTable() {
        var stName = document.getElementById("txtName").value;
        if(stName.replace(/(^\s*)|(\s*$)/g,  "").length < 1) {
            showNoticMsg("txtName", QT_MESSAGE_INPUTNAME);
            document.getElementById("txtName").focus();
           return false;
        }
        
        if(stName.search(/[`~!@#$%^&*+=|\\\][\]\{\}:;\"'\,.<>/?]/g) != -1) {
            showNoticMsg("txtName", QT_DISABLE_HTML);
            document.getElementById("txtName").focus();
           return false;
        }
    
        if(document.getElementById("selTypeEdit").value == -1) {
            showNoticMsg("selTypeEdit", QT_MESSAGE_SELECT_A_STYLE);
            document.getElementById("selTypeEdit").focus();
           return false;
        }
        
        if(document.getElementById("selPopupStc").value == -1) {
            showNoticMsg("selPopupStc", QT_CHOOSE_A_STC);
            document.getElementById("selPopupStc").focus();
           return false;
        }
        
        var nameList = self.parent.leftFrame.GetStNameInSelectedStc(document.getElementById("selPopupStc").value);
        if(nameList.replace(/(^\s*)|(\s*$)/g,  "") != null && nameList.replace(/(^\s*)|(\s*$)/g,  "").length > 0) {
            var nameArr = nameList.split(",");
            var isSelf = true;
            for(var i = 0; i < nameArr.length; i++) {
                if(stName.replace(/(^\s*)|(\s*$)/g,  "") == nameArr[i] && 
                document.getElementById("hidStOldName").value != stName.replace(/(^\s*)|(\s*$)/g,  "")){
                    showNoticMsg("txtName", QT_MESSAGE_BEEN_NAMED_ST);
                    document.getElementById("txtName").focus();
                    return false;
                }
            }
        }
        
        return true;
    }
    
    //  重置弹出窗口
    function ResetSTPop() {
        document.getElementById("hidStId").value = "";
        document.getElementById("hidStcId").value = "";
        document.getElementById("txtName").value = "";
        document.getElementById("selTypeEdit").value = -1;
    }
//------------------------------------------------------------------------

//------------------------------------------------------------------------
//  题目分类弹出对话框
    function ShowAddReqClsForm(stId)
    {
        ResetReqClsPop();
    	ShowPopForm("reqClsPopup", "reqClsNameTitle", "新增");
    	self.parent.leftFrame.showMask();
    	document.getElementById("hidReqClsStId").value = stId;
    	document.getElementById("hidReqClsPopClsId").value = "";
    	document.getElementById("hidReqClspopType").value = "add";
    }
    
    function ShowModifyReqClsForm(id, name, stId, index)
    {
        ResetReqClsPop();
    	ShowPopForm("reqClsPopup", "reqClsNameTitle", "修改");
    	self.parent.leftFrame.showMask();
    	document.getElementById("hidReqClsPopClsId").value = id;
    	document.getElementById("txtReqClsName").value = name.htmlDecode();
    	document.getElementById("hidReqClsStId").value = stId;
    	document.getElementById("hidReqClsIndex").value = index;
    	
    	document.getElementById("hidReqClspopType").value = "modify";
    }
    
    function btnReqClsOK_onclick()
    {
        if(!VerifyReqCls())
            return;
            
	    if(document.getElementById("hidReqClspopType").value == "add")
            AddReqClsJs();
        else if(document.getElementById("hidReqClspopType").value == "modify")
            ModifyReqClsJs();
    }
    
    // 验证题目类别输入
    function VerifyReqCls() {
        if(document.getElementById("txtReqClsName").value.replace(/(^\s*)|(\s*$)/g,  "").length < 1) {
            showNoticMsg("txtReqClsName", QT_MESSAGE_INPUT_REQCLS_NAME);
            document.getElementById("txtReqClsName").focus();
           return false;
        }
        
        if(document.getElementById("txtReqClsName").value.search(/[`~!@#$%^&*+=|\\\][\]\{\}:;\"'\,.<>/?]/g) != -1) {
            showNoticMsg("txtReqClsName", QT_DISABLE_HTML);
            document.getElementById("txtReqClsName").focus();
           return false;
        }
        
        return true;
    }
    
    //  重置弹出窗口
    function ResetReqClsPop() {
        document.getElementById("hidReqClsPopClsId").value = "";
        document.getElementById("txtReqClsName").value = "";
        document.getElementById("hidReqClsStId").value = "";
    }
//------------------------------------------------------------------------

//------------------------------------------------------------------------
//  题目编辑对话框

    function ShowAddReqForm(reqClsId) {
        ResetReqPop();
    	ShowPopForm("reqPopup", "reqNameTitle", "新增题目");
    	self.parent.leftFrame.showMask();
    	document.getElementById("hidReqPopReqClsId").value = reqClsId;
    	document.getElementById("hidReqPopType").value = "add";
    	
    	SetReqTypeCtrl(true);
    	ConvertXmlToTable();
    }
    
    function ShowModifyReqForm(reqId, reqClsId, reqType, reqTitle, reqOpt, totalScore, index) {
    	ResetReqPop();
    	self.parent.leftFrame.showMask();
    	document.getElementById("hidReqPopReqId").value = reqId;
    	document.getElementById("hidReqPopReqClsId").value = reqClsId;
    	document.getElementById("hidReqPopType").value = "modify";
        document.getElementById("hidReqPopIndex").value = index;
        
    	document.getElementById("optXml").innerHTML = reqOpt.htmlDecode();
    	document.getElementById("txtReqContext").value = reqTitle.htmlDecode();
    	document.getElementById("txtReqScore").value = totalScore;
    	
    	ShowPopForm("reqPopup", "reqNameTitle", "编辑题目");
    	if(reqType == 0)
    	{
    	    SetReqTypeCtrl(true);
    	    ConvertXmlToTable();
    	}
    	else
    	    SetReqTypeCtrl(false);
    }

    function rdReqTypeAns_Onclick() {
    	SetReqTypeCtrl(false);
    }

    function rdReqTypeOpt_Onclick() {
    	SetReqTypeCtrl(true);
    }
    
    function SetReqTypeCtrl(isOpt) {
        if(isOpt) {
            document.getElementById("optTd").style.display = "block";
            document.getElementById("txtReqScore").disabled = true;
            document.getElementById("rdReqTypeOpt").checked = "checked";
            //InitOptTree(ConvertXmlToTreeTypeXml());
            //ModifyOptContextXML();
        }
        else {
            document.getElementById("optTd").style.display = "none";
            document.getElementById("txtReqScore").value = 0;
            document.getElementById("txtReqScore").disabled = true;
            
            document.getElementById("rdReqTypeAns").checked = "checked";
        }
    }

    function ConvertXmlToTable()
    {
        var optList = document.getElementById("optXml");
    	var xmlObj = new ActiveXObject("Microsoft.XMLDOM"); 
        xmlObj.loadXML(optList.innerHTML); 
    	var treeXml = document.createElement("xmp");
    	
    	var optNodes = xmlObj.selectNodes("/opts/opt");
    	for(var i = 0; i < optNodes.length; i++)
    	{   
    	    var title = optNodes[i].selectSingleNode("title");
    	    if(title == null)
    	        title = optNodes[i].selectSingleNode("TITLE");
    	  
            AddOptTableItem(title.text.htmlDecode(), optNodes[i].selectSingleNode("score").text);
    	}
    }

    function btnReqOK_onclick() {
    
        if(document.getElementById("rdReqTypeOpt").checked == true) {
            if(!ConvertTableToXML())
                return;
        }
        if(!VerifyReq())
            return;
    	if(document.getElementById("hidReqPopType").value == "add")
            AddReqJs();
        else if(document.getElementById("hidReqPopType").value == "modify")
            ModifyReqJs();
    }
    
    function btnReqCancel_onclick() {
        var optList = document.getElementById("optXml");
        optList.innerHTML = "";
        var optsItem = document.createElement("opts");
    
        var optTable = document.getElementById("optList");
        var maxScore = 0;
        for(var i = 1; i < optTable.rows.length; i++) {
            optTable.rows(i).cells(1).childNodes("txtOptContext").value = '';
        }
    	ClosePopForm("reqPopup");
        self.parent.leftFrame.hideMask();
    }
    
    function btnAddOpt_onclick() {
    	//ShowAddOpt();
    	AddOptTableItem();
    }
    
    function AddOptTableItem(context, score)
    {
        var optTable = document.getElementById("optList");
        if(optTable.rows.length > 10) {
            //showNoticMsg("btnAddOpt", QT_MESSAGE_MAXOPT);
            return;
        }
    	var optRow = optTable.insertRow();
    	var optTdCode = optRow.insertCell();
    	var lastRow = optTable.rows(optRow.rowIndex-1);
    	var hiddenObj = lastRow.cells(0).children("maxRowIndex");
    	var newRowId;
    	if(hiddenObj == null) {
    	    newRowId = 1;
    	}
    	else {
    	    newRowId = (Number(hiddenObj.value)+1);
    	}
    	optTdCode.innerHTML = GetOptIndex(lastRow.rowIndex) + "<input name='maxRowIndex' type='hidden' value='"+newRowId+"'/>";
    	var optTdText = optRow.insertCell();
    	optTdText.innerHTML = "<input name='txtOptContext' maxlength=\"80\" style='width: 350px' type='text' value='"+(context==null?new String(""):context)+"' />";
    	var optTdScore = optRow.insertCell();
    	optTdScore.innerHTML = "<input style=\"text-align:right;\" maxlength=\"5\" name='txtOptScore' style='width:37px; padding-right:3px;' type='text' value='"+(score==null?0:Number(score))+"'  onkeypress='event.returnValue=((event.keyCode>=48)&&(event.keyCode<=57));'/>";
    	var optTdDel = optRow.insertCell();
    	optTdDel.innerHTML = "<img id='btnOptDel_"+newRowId+"' onclick='btnDelOpt_onclick("+newRowId+")' src=\"../Common/images/delete.jpg\" alt=\"删除\"  style=\"padding:1 2 1 2;\" />";
    	optTdText.focus();
    }
    
    function btnDelOpt_onclick(rowIndex) {
        var optTable = document.getElementById("optList");
        var afterDeletedRow = false;
        for(var i = 1; i < optTable.rows.length; i++)
        {
            if(optTable.rows(i).cells(0).children("maxRowIndex").value == rowIndex)
            {
                optTable.deleteRow(i);
                afterDeletedRow = true;
                i--;
                continue;
            }
            if(afterDeletedRow)
            {
                var rowObj = optTable.rows(i);
                if(rowObj == null)
                    break;
                rowObj.cells(0).innerHTML = GetOptIndex(i-1) + rowObj.cells(0).children("maxRowIndex").outerHTML;
            }
        }
    }

    function ConvertTableToXML() {
        var optList = document.getElementById("optXml");
        optList.innerHTML = "";
        var optsItem = document.createElement("opts");
    
        var optTable = document.getElementById("optList");
        var maxScore = 0;
        for(var i = 1; i < optTable.rows.length; i++) {
            var optItem = document.createElement("opt");
    	    
    	    var indexItem = document.createElement("index");
    	    indexItem.innerHTML = GetOptIndex(i-1);
    	    
    	    var titleItem = document.createElement("title");
    	    var optContext = optTable.rows(i).cells(1).childNodes("txtOptContext").value.htmlEncode();
    	    var scoreItem = document.createElement("score");
    	    var optScore = optTable.rows(i).cells(2).childNodes("txtOptScore").value.replace(/(^\s*)|(\s*$)/g,  "");
    	    if(!VerifyOpt(optTable.rows(i).cells(1).childNodes("txtOptContext"), optTable.rows(i).cells(2).childNodes("txtOptScore")))
    	        return false;
    	    
    	    titleItem.innerHTML = optContext;
    	    scoreItem.innerHTML = Number(optScore);
    	    
    	    maxScore = Math.max(maxScore, Number(scoreItem.innerHTML));
    	    
    	    optItem.appendChild(indexItem);
    	    optItem.appendChild(titleItem);
    	    optItem.appendChild(scoreItem);
    	    
    	    optsItem.appendChild(optItem);
        }
        document.getElementById("txtReqScore").value = maxScore;
        optList.innerHTML = optsItem.outerHTML;
        return true;
    }
    
    // 验证选项
    function VerifyOpt(contextCell, scoreCell) {
    
        if(contextCell.value.replace(/(^\s*)|(\s*$)/g,  "").length < 1) {
            contextCell.focus();
            showNoticMsg("btnReqOK", QT_MESSAGE_INPUT_OPT_TEXT, -10, 20);
            
           return false;
        }
        if(contextCell.value.replace(/(^\s*)|(\s*$)/g,  "").length > 80) {
            contextCell.focus();
            showNoticMsg("btnReqOK", QT_MAX_OPTCONTEXT, -10, 20);
            
            return false;
        }
        
        if(contextCell.value.search(/[<>]/g) != -1) {
           contextCell.focus();
           showNoticMsg("optList", QT_DISABLE_HTML);
           return false;
        }
        
        var txtScore = scoreCell.value.replace(/(^\s*)|(\s*$)/g,  "");
        if(isNaN(Number(txtScore)) || txtScore.length < 1) {
            scoreCell.focus();
            showNoticMsg("btnReqOK", QT_MESSAGE_INPUT_SCORE, -10, 20);
            
           return false;
        }
        
        if(txtScore.search(/^\d+$/g) == -1) {
            scoreCell.focus();
            showNoticMsg("btnReqOK", "输入合法的分数", -10, 20);
            
            return false;
        }
        
        if(txtScore.length > 5) {
            scoreCell.focus();
            showNoticMsg("btnReqOK", QT_MAX_SCORE, -10, 20);
            
            return false;
        }
        
        return true;
    }

    function GetOptIndex(i) {
    	return String.fromCharCode(i+65);
    }
    
    // 验证题目输入
    function VerifyReq() {
        if(document.getElementById("txtReqContext").value.replace(/(^\s*)|(\s*$)/g,  "").length < 1) {
            showNoticMsg("txtReqContext", QT_MESSAGE_INPUT_REQ_TEXT);
            document.getElementById("txtReqContext").focus();
           return false;
        }
        
        if(document.getElementById("txtReqContext").value.replace(/(^\s*)|(\s*$)/g,  "").length > 500) {
            showNoticMsg("txtReqContext", QT_MAX_REQCONTEXT);
            document.getElementById("txtReqContext").focus();
           return false;
        }
        
//        if(document.getElementById("txtReqContext").value.search(/[/<>]/g) != -1) {
//            showNoticMsg("txtReqContext", QT_DISABLE_HTML);
//            document.getElementById("txtReqContext").focus();
//           return false;
//        }
        
        if(document.getElementById("rdReqTypeOpt").checked) {
            //var treeNode = treeControl.getAllChildless();
    	    //var nodeArr = treeNode.split(",");
    	    var optTable = document.getElementById("optList");
            if(optTable.rows.length < 2){
                showNoticMsg("optList", QT_MESSAGE_CREATE_A_OPT);
            return false;
            }
        }

        return true;
    }
    
    //  重置弹出窗口
    function ResetReqPop() {
        document.getElementById("txtReqScore").value = "";
        document.getElementById("txtReqContext").value = "";
        document.getElementById("optXml").innerHTML = "";
        var optTable = document.getElementById("optList");
        for(var i = optTable.rows.length-1; i > 0; i--)
        {
            optTable.deleteRow(i);
        }
    }
//------------------------------------------------------------------------

//------------------------------------------------------------------------
//  导入题目对话框
    
    //  导入题目按钮
    function btnImport_OnClick(reqClsId, stId) {
        gReqClsId = reqClsId;
        //gStClsId = document.getElementById("<%= txtStIdOnServer.ClientID%>").value;
        gStId = stId;
        ShowImportForm(reqClsId);
        self.parent.leftFrame.showMask();
    }
    var gReqClsId;
    var gStClsId;
    var gStId;
    function ShowImportForm(reqClsId) {
        ShowPopForm("importPop", "importTitle", "导入题目");
        window.frames["importPopFrame"].location = "ImportForm.aspx?stId="+gStId;//+"&stcId="+gStClsId;
        //window.frames["importPopFrame"].document.getElementById("hidImportReqClsId").value = reqClsId;
    }
    
    function btnImportOk_onclick() {
        var list = window.frames["importPopFrame"].window.GetSelectQuesitons();
        //alert(list.length);
        PageMethods.ImportQuestions(list,gReqClsId,
            function (succ) {
            	ClosePopup("importPop");
            	F5Repeater();
            	self.parent.leftFrame.hideMask();
            },
            function (err) {
            	ShowMessageWithCallBack(QT_TITLE_MESSAGE, QT_IMPORT_FAIL, 2);
            }
        );
    }
//------------------------------------------------------------------------

//------------------------------------------------------------------------
// 样表复制对话框

    // 显示样表复制对话框
    function ShowCopyQuestionnaireForm(obj, stcList) {
    
        ShowPopForm("copyPop", "copyPopTitle", "复制样表");
        
        self.parent.leftFrame.showMask();
        InitStcSelect(stcList, "selCopyPopStcId");

        document.getElementById("txtCopyPopStName").value = "样表复件";
        document.getElementById("hidCopyPopStId").value = obj.RID;
        document.getElementById("hidCopyPopTypeEdit").value = obj.StType;
    }
    
    function btnCopyPopOK_onclick() {
        if(!VerifyCopyForm())
            return;
            
        CopyQuestionnaireJs(document.getElementById("hidCopyPopStId").value);
    }
    
    function VerifyCopyForm() {
        var stName = document.getElementById("txtCopyPopStName").value;
        if(stName.replace(/(^\s*)|(\s*$)/g,  "").length < 1) {
            showNoticMsg("txtCopyPopStName", QT_MESSAGE_INPUTNAME);
            document.getElementById("txtCopyPopStName").focus();
           return false;
        }
        
        if(stName.search(/<\/?[^>]+>/g) != -1) {
            showNoticMsg("txtCopyPopStName", QT_DISABLE_HTML);
            document.getElementById("txtCopyPopStName").focus();
           return false;
        }
        
        if(document.getElementById("selCopyPopStcId").value == -1) {
            showNoticMsg("selCopyPopStcId", QT_COPY_TO_WHERE);
            document.getElementById("selCopyPopStcId").focus();
           return false;
        }
        
        var nameList = self.parent.leftFrame.GetStNameInSelectedStc(document.getElementById("selCopyPopStcId").value);
        if(nameList != null && nameList.length > 0) {
            var nameArr = nameList.split(",");
            for(var i = 0; i < nameArr.length; i++) {
                if(stName == nameArr[i]){
                    showNoticMsg("txtCopyPopStName", QT_MESSAGE_BEEN_NAMED_ST);
                    document.getElementById("txtCopyPopStName").focus();
                    return false;
                }
            }
        }
        
        return true;
    }
//------------------------------------------------------------------------

//------------------------------------------------------------------------
//  移动题目对话框

    // 显示移动题目对话框
    function ShowMoveReqForm(reqId, reqClsId, reqClsList) {
        ShowPopForm("moveReqPop", "moveReqPopTitle", "移动题目");
        self.parent.leftFrame.showMask();
        
        InitReqClsId(reqClsList, reqClsId);
        //document.getElementById("selMoveReqPopReqClsId").value = 0;
        document.getElementById("hidMoveReqPopReqId").value = reqId;
        //document.getElementById("hidCopyPopTypeEdit").value = obj.StType;
    }
    
    function btnMoveReqPopOK_onclick() {
        var destId = document.getElementById("selMoveReqPopReqClsId").value;
        if(destId == -1) {
            showNoticMsg("selMoveReqPopReqClsId", "请选择一个题目类别. 这样才能正确的完成移动题目的操作.");
            return;
        }
        MoveReqJs(document.getElementById("hidMoveReqPopReqId").value, destId);
    }
    
    function InitReqClsId(reqClsList, reqClsId) {
        var selectObj = document.getElementById("selMoveReqPopReqClsId");
        selectObj.innerHTML = "";
        var oOption;
        oOption = document.createElement("OPTION");
        oOption.innerText = "--请选择大题--";
        oOption.value = -1;
        selectObj.appendChild(oOption);
        if(reqClsList != null){
            for(var i = 0; i < reqClsList.length; i++) {
                if(reqClsId == reqClsList[i].RID)
                    continue;
                oOption = document.createElement("OPTION");
                oOption.innerText = reqClsList[i].ClsName.htmlDecode();
                oOption.value = reqClsList[i].RID;
                selectObj.appendChild(oOption);
            }
        }
    }

//------------------------------------------------------------------------